#ifndef RATIONAL_H
#define RATIONAL_H
#include <iostream>
#include <string>
using std::istream;
using std::ostream;
using std::string;
class Rational {
  private:
    int fenZi;
    int fenMu;
    static int gcd(int n, int d);

  public:
    Rational();
    Rational(int fenZi, int fenMu);
    Rational(int fenZi);
    int getFenZi() const;
    int getFenMu() const;
    Rational add(const Rational& secondRational) const;
    Rational subtract(const Rational& secondRational) const;
    Rational multiply(const Rational& secondRational) const;
    Rational divide(const Rational& secondRational) const;
    int compareTo(const Rational& secondRational) const;
    bool equals(const Rational& secondRational) const;
    int intValue() const;
    double doubleValue() const;
    string toString() const;
    bool operator<(const Rational& secondRational) const;
    Rational operator+(const Rational& secondRational) const;
    Rational operator-(const Rational& secondRational) const;
    int& operator[](int index);
    Rational& operator+=(const Rational& secondRational);
    Rational operator-() const;
    Rational& operator++();
    Rational operator++(int dummy);
    // operator double();
    friend ostream& operator<<(ostream& out, const Rational& rational);
    friend istream& operator>>(istream& in, Rational& rational);
    ~Rational();
};


#endif